<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!Doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>注册</title>
    <link href="/static/css/common/common.css" rel="stylesheet" type="text/css"/>
    <link href="/static/css/common/style.css" rel="stylesheet" type="text/css"/>
    <link href="/static/css/common/user.css" rel="stylesheet" type="text/css"/>

    <script src="/static/js/jquery.js" type="text/javascript"></script>
    <script src="/static/js/formValidator-4.1.1.js" type="text/javascript"></script>
    <script src="/static/js/formValidatorRegex.js" type="text/javascript"></script>
    <script src="/static/js/common.js" type="text/javascript"></script>
    <script src="/static/js/formcheck.js" type="text/javascript"></script>
    <script src="/static/js/json.min.js" type="text/javascript"></script>
    <script src="/static/js/jquery.json-2.2.min.js" type="text/javascript"></script>
    <style>
        table, tr, td {
            border: none;
        }

        table tr {
            height: 40px;
        }

        .noticeWrap {
            padding: 0px;
            float: none;
        }

        .noticeWrap span {
            float: none;
            line-height: normal;
        }

        .user_client p {
            margin-bottom: 0px;
            width: 100%;
            float: none;
        }
    </style>
</head>
<body id="reg">
<jsp:include page="themes/header.jsp"/>
<div class="w100">
    <div class="w1000">
        <div class="reg_pic"></div>
        <div class="user_client">
            <div class="user_client_left">
                <form id="regform" method="post" action="#" onsubmit="return false;">
                    <table class="tab1">
                        <tr>
                            <td align="right">* 邮箱:</td>
                            <td width="150px"><input type="text" id="email" name="email" style="width:140px"/></td>
                            <td>
                                <div id="emailTip" style="width:280px"></div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">* 昵称</td>
                            <td><input type="text" id="tname" name="tname" style="width:140px"/></td>
                            <td>
                                <div id="tnameTip" style="width:280px"></div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">* 密码:</td>
                            <td><input type="password" id="password" name="password1" style="width:140px"/></td>
                            <td>
                                <div id="passwordTip" style="width:280px"></div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">* 确认密码</td>
                            <td><input type="password" id="repassword" name="password2" style="width:140px"/></td>
                            <td>
                                <div id="repasswordTip" style="width:280px"></div>
                            </td>
                        </tr>
                    </table>
                    <p>
                        <span> <input type="submit" value="免费注册" class="uc_submit btn_yellow"
                                      onclick="reg();return false;"> </span>
                        <span class="quicklogin">已有账号? <a class="fcf60" href="/loginReg/login.do">点此登录 »</a></span>
                    </p>
                </form>
            </div>
            <div class="clearer"></div>
        </div>
    </div>
    <jsp:include page="themes/footer.jsp"/>
</div>
<!--#include virtual="/themes/orange/footer.html"-->
</body>
<script type="text/javascript">
    function reg() {
        var jsonInfro = $.toJSON($('#regform').serializeObject());
        jQuery.ajax({
            type : 'POST',
            contentType : 'application/json',
            url : '/reg.do',
            data: jsonInfro,
            dataType : 'json',
            success : function(data) {
                if (data.msg == '1') {
                    window.location.href = "/login.shtml";
                } else if (data.msg == '-1') {
                    alert("邮箱重复！");
                } else if (data.msg == '-2') {
                    alert("用户昵称重复！");
                }else {
                    alert("注册失败，稍后再试！");
                }

            },
            error : function() {
                alert("服务器繁忙中！稍后再试！");
            }
        });

    }
</script>
</html>
